package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.Toast;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    EditText name;
    EditText eamil;
    EditText password;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        name = findViewById(R.id.name);
        name.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(MainActivity.this, "请输入姓名", Toast.LENGTH_LONG).show();
            }
        });
        eamil = findViewById(R.id.eamil);
        eamil.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(MainActivity.this, "请输入邮箱", Toast.LENGTH_LONG).show();
            }
        });
        password = findViewById(R.id.password);
        password.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(MainActivity.this, "请输入密码", Toast.LENGTH_LONG).show();
            }
        });
        View button = findViewById(R.id.button);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String n = String.valueOf(name.getText());
                String e = String.valueOf(eamil.getText());
                String pas = String.valueOf(password.getText());
                if (!n.equals("") && !e.equals("") && !pas.equals(""))
                    System.out.println("注册成功：" + "姓名：" + n + "  邮箱：" + e);
                else {
                    Toast.makeText(MainActivity.this, "注册信息不能为空", Toast.LENGTH_LONG).show();
                }
            }
        });
    }
}